package com.xm;

public class VarType_InstanceVar02 {
    // 这个成员变量对子类可见
    public String name="zhang";
    // 私有变量，近在该类可见
    private double salary;

    // 在构造其中对name赋值
    public VarType_InstanceVar02(String name) {
        this.name = name;
    }

    // 设定salary的值
    public void setSalary(double salary) {
        this.salary = salary;
    }

    public void print() {
        System.out.println("名字 = " + name);
        System.out.println("薪水 = " + salary);
    }
    public static void main(String[] args) {

        VarType_InstanceVar02 varTypeInstanceVar02 = new VarType_InstanceVar02("RUNOOB");
        varTypeInstanceVar02.setSalary(1000);
        varTypeInstanceVar02.print();
    }
}
